package com.example.springboottest.example.jvm;

import com.example.springboottest.student.model.Student;

import java.util.ArrayList;
import java.util.List;

/**
 * VM Args：-Xms20m -Xmx20m -XX:+HeapDumpOnOutOfMemoryError
 * <p>
 * 可以在内存溢出的时候，保存出当时的dump，方便定位问题
 *
 * @author zzm
 */
public class HeapOOM {
//    static class OOMObject {
//    }

    public static void main(String[] args) {
        List<Student> list = new ArrayList<Student>();
        int id = 1;
        while (true) {
            list.add(new Student("" + id, "name_" + id, id, "address_" + id));
            id++;
        }
    }
}
